package com.vancouver.knows.ui.activity.my;

import android.content.Context;
import android.view.View;

import com.pangu.task.mark.ATaskMark;
import com.pangu.ui.refresh.ARefreshViewController;
import com.pangu.ui.refresh.RefreshControllerView;
import com.vancouver.knows.business.BusinessModule;
import com.vancouver.knows.MainApplication;

/**
 * 我的评论全部内容查看页面
 * 
 * @author llf
 * 
 */
public class MyAtcommentPullRefreshView extends RefreshControllerView {

	public MyAtcommentPullRefreshView(Context context) {
		super(context);
	}

	@SuppressWarnings("rawtypes")
	@Override
	public void onRefresh(ARefreshViewController controller) {
		((MyAtcommentListView) content).handleRefreshLoadItem();
	}

	public void loadData() {
		BusinessModule module = ((MainApplication) imContext).getBusinessModule();
		ATaskMark aTaskMark = module.getTaskMarkPool().getMyAtcommentTaskMark();
		//aTaskMark.reinitTaskMark();
		((MyAtcommentListView) content).initLoadableView(aTaskMark);
		
		int count = module.getCacheManager().getMyAtcommentCache().getItemInfoCount(aTaskMark);
		if (count > 0 && aTaskMark.getTaskStatus() != ATaskMark.HANDLE_WAIT
				&& aTaskMark.getTaskStatus() != ATaskMark.HANDLE_DOING) {
			((MyAtcommentListView) content).handleRefreshLoadItem();
		}else {
			if (count==0 && aTaskMark.getTaskStatus() != ATaskMark.HANDLE_DOING) {
				aTaskMark.reinitTaskMark();
			}
		}
	}

	@Override
	protected View createContentView() {
		return new MyAtcommentListView(getContext(), this);
	}

}
